home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 Super Collection / Windows 95 Super Collection.iso / win95 / internet / rcp3217 / rcpdll32.doc < prev    next >
Encoding:
Text File  |  1995-08-16  |  37.7 KB  |  984 lines

  1.   Winsock RCP32.DLL                                  Version 1.7
  2.   Copyright 1994 Denicomp Systems
  3.   All rights reserved
  4.  
  5.   
  6.   DESCRIPTION
  7.   -----------
  8.   
  9.   Winsock RCP32.DLL is a Microsoft Win32 Dynamic Link Library (DLL) that
  10.   provides a Windows Sockets compatible function that allows you to copy files
  11.   over TCP/IP using the RCP protocol.  You can copy files from a Windows PC to
  12.   a remote host, from the remote host to your PC, or between two remote hosts.
  13.  
  14.   The function calls in RCP32.DLL are similar to those in the 16-bit Winsock
  15.   RCP.DLL available for Windows 3.1.  However, they are NOT completely
  16.   compatible; new parameters have been added to the 32-bit versions.
  17.  
  18.   Winsock RCP32.DLL provides most of the services of the "rcp" command found
  19.   on many Unix systems, including recursive copies.  It also includes the
  20.   ability to convert text files to the appropriate format for Unix or MS-DOS.
  21.  
  22.   The remote host must be a system running the rshd server (a Unix system,
  23.   a Windows 3.x PC running Denicomp Systems' Winsock RSHD, or a Windows NT
  24.   system running Denicomp Systems' Winsock RSHD/NT).
  25.  
  26.   
  27.   REQUIREMENTS
  28.   ------------
  29.  
  30.   Winsock RCP32.DLL requires a PC running Windows NT or Windows 95 or any
  31.   other Windows operating system that supports WSOCK32.DLL, a connection
  32.   via TCP/IP to a remote host running rshd, and any programming language that
  33.   supports calls to 32-bit DLL functions, such as C.
  34.  
  35.  
  36.  
  37.   =============================================================================
  38.  
  39.   FUNCTION: WinsockRCP
  40.  
  41.   Syntax:
  42.   -------
  43.  
  44.   C:
  45.   
  46.   INT WinsockRCP (hWndParent, Title, Src, Dest,
  47.                   RecurFlag, AsciiFlag, ConsoleFlag, CaseFlag, HiddenFlag,
  48.                   SpaceChar)
  49.   
  50.        HWND hWndParent;
  51.        char *Title;
  52.        char *Src;
  53.        char *Dest;
  54.        int RecurFlag;
  55.        int AsciiFlag;
  56.        int ConsoleFlag;
  57.        int CaseFlag;
  58.        int HiddenFlag;
  59.        int SpaceChar;
  60.   
  61.  
  62.   * Visual Basic:
  63.  
  64.   Declare Function WinsockRCP Lib "RCP32.DLL"
  65.                      (ByVal hWndParent As Integer,
  66.                       ByVal Title As String,
  67.                       ByVal Src As String,
  68.                       ByVal Dest As String,
  69.                       ByVal RecurFlag As Integer,
  70.                       ByVal AsciiFlag As Integer,
  71.                       ByVal ConsoleFlag As Integer,
  72.                       ByVal CaseFlag As Integer,
  73.                       ByVal HiddenFlag As Integer,
  74.                       ByVal SpaceChar As Integer) As Integer
  75.  
  76.  
  77.   * - Requires a version of Visual Basic that can call 32-bit DLL's
  78.  
  79.  
  80.   PowerBuilder:
  81.  
  82.    (In Global External Functions Window)
  83.  
  84.   Function Int WinsockRCP (Int hWndParent, &
  85.                            Ref String Title, & 
  86.                            Ref String Src, &
  87.                            Ref String Dest, &
  88.                            Int RecurFlag, &
  89.                            Int AsciiFlag, &
  90.                            Int ConsoleFlag, &
  91.                            Int CaseFlag, &
  92.                            Int HiddenFlag, &
  93.                            Int SpaceChar) Library "RCMD32.DLL"
  94.  
  95.   Usage:
  96.   ------
  97.   
  98.   The WinsockRCP function copies the Source to the Destination.  The
  99.   Source and Destinations are file specifications that can include a
  100.   user name, a host name, and a file name, which may include wildcard
  101.   characters, such as * and ?.
  102.  
  103.   Any errors that occur are displayed in standard Windows message boxes.
  104.   See the WinsockRCP2() function if you wish to handle the displaying
  105.   of error messages within your program.
  106.  
  107.  
  108.   Parameters:
  109.   -----------
  110.  
  111.   hWndParent:  The handle (HWND) of a window in your application.  The
  112.                WinsockRCP function may produce diagnostic error messages
  113.                using the Windows MessageBox function.  This is used to
  114.                specify the "parent" window to the MessageBox function.  It may
  115.                be NULL, meaning that the message box has no parent.
  116.   
  117.                NOTE:  If your program is a Windows NT "console"
  118.                       application, you should specify NULL for this
  119.                       parameter and see the ConsoleFlag parameter
  120.                       for details about displaying error messages to
  121.                       the console window.
  122.  
  123.   Title:       The title of your application or some other title.  If any
  124.                diagnostic error messages are displayed using the Windows
  125.                MessageBox function, this will be used as the title of the
  126.                message box.
  127.   
  128.   Src:         The file or directory to copy.  See below for the format.
  129.  
  130.   Dest:        The destination of the file(s).  See below for the format.
  131.   
  132.   RecurFlag:   Specifies whether or not the copy should be recursive.
  133.                A recursive copy copies entire directory trees.  The options are:
  134.  
  135.  
  136.       0 - Directories will not be copied.  If you attempt to copy a directory,
  137.           you will receive an error message.  This occurs if you explicitly try
  138.           to copy a directory by specifying its name or directory names are
  139.           matched by the wildcard pattern you specify.  If you specify a
  140.           wildcard pattern that matches both files and directories, the files
  141.           will be copied, but you will receive an error message for each
  142.           directory matched.
  143.  
  144.       1 - Directories will be recursively copied.  If you explicitly copy a
  145.           directory by specifying its name, all files in that directory and
  146.           the files in all subdirectories of that directory will be copied.
  147.           The directory structure will be recreated on the destination system.
  148.           If you specify a wildcard pattern, all directories matching that
  149.           pattern will be recursively copied in addition to any matching files.
  150.  
  151.      -1 - Specifying -1 (negative one) will not recursively copy directories,
  152.           but it will suppress any error messages if your wildcard pattern
  153.           matches directories.  That is, your wildcard pattern will match only
  154.           files, not directories.  This is similar to specifying 0 (zero), but
  155.           you will not receive error messages if you attempt to copy
  156.           directories.
  157.   
  158.   AsciiFlag:   Specifies whether or not the copy should convert the file
  159.                to the proper text file format.  If the file is being copied
  160.                TO a remote host, CR/NL (ASCII 13/10) combinations are replaced
  161.                with one NL (ASCII 10).  If the file is being copied FROM a
  162.                remote host, NL's are replaced by CR/NL combinations.
  163.  
  164.                Use a value of 0 if the files are not to be converted or
  165.                a value of 1 if they are to be converted.
  166.  
  167.  
  168.   ConsoleFlag: Specifies whether or not your application is a Windows NT
  169.                "console" application.  If you specify a value of 0, error
  170.                messages will be displayed in standard Windows message boxes.
  171.                If you specify a value of 1, error messages will be displayed
  172.                to the console window using the "printf" function.
  173.  
  174.  
  175.   CaseFlag:    Specifies whether or not the case of filenames is preserved
  176.                when performing recursive copies or using wildcards.
  177.  
  178.                This affects recursive and wildcard copies ONLY.  If you
  179.                use a specific, individual filename, the case you use will
  180.                be preserved.
  181.  
  182.                With Windows NT, filenames can be stored using mixed case
  183.                characters, even though the filesystem is NOT case sensitive.
  184.                For example, "ABC" and "abc" represent the same file.  However,
  185.                the directory entry is displayed in the case you used when the
  186.                file was created.
  187.                
  188.                If you specify a value of 0, the case of filenames will NOT
  189.                be preserved.  All filenames will be converted to lower case
  190.                characters as they are received from or sent to the host.
  191.  
  192.                If you specify a value of 1, the case of filenames IS
  193.                preserved.  Filenames will be created on the local system
  194.                in the same case as they existed on the remote host. Likewise,
  195.                filenames on the local system will be created in the same
  196.                case on the remote host as they appear in the directory on
  197.                the local system.
  198.  
  199.  
  200.   HiddenFlag:  Specifies whether or not files with the "hidden" attribute
  201.                are copied when doing recursive copies or using wildcards.
  202.  
  203.                If you specify a value of 0, hidden files will not be
  204.                copied.  If you specify a value of 1, hidden files will
  205.                be copied.
  206.  
  207.  
  208.   SpaceChar:   Allows you to substitute a character for space characters
  209.                (ASCII 32) in filenames.
  210.  
  211.                If you specify a value of 0, filenames are sent to the remote
  212.                host exactly as they appear on the local system or exactly
  213.                as specified in the Dest parameter.
  214.  
  215.                Some systems cannot easily handle filenames with embedded
  216.                spaces.  If you pass a character in this parameter
  217.                (as an integer value), that character will be substituted
  218.                for each space in the filename created on the remote host.
  219.  
  220.                For example, if you pass an underscore (_) in this parameter,
  221.                the filename:
  222.  
  223.                       "this is a file.txt"
  224.  
  225.                will be created on the remote host as:
  226.  
  227.                       "this_is_a_file.txt"
  228.  
  229.                This affects ONLY directory names and filenames created on the
  230.                remote host.  It has no effect when files are being copied from
  231.                the remote host to the local system.
  232.  
  233.  
  234.   Source and Dest Specifications
  235.   ------------------------------
  236.  
  237.   Both the Source and Dest parameters must be of the following format:
  238.  
  239.        [[User@][Host:]]{File | Dir}
  240.  
  241.  
  242.   User@   (optional)  Specifies the user name to be used at the remote
  243.           host.  If this prefixes the Host: parameter, this user name
  244.           overrides the user name of the PC.
  245.  
  246.   Host:   Specifies the host name of the remote host.  This is not
  247.           required if the file or directory referenced is on the PC.
  248.           This host must be a system running the rshd server process.
  249.           That is, you cannot use the host name of another PC running
  250.           Windows or MS-DOS.
  251.  
  252.   File      Specifies the file name of the source or destination file.  You
  253.           may use wildcard characters to copy multiple source files.  You
  254.           may also specify multiple source files individually by separating
  255.           the names with spaces.
  256.  
  257.   Dir     Specifies the file name of the source or destination directory.
  258.           The source may be a directory only if you are using the recursive
  259.           copy option.  The destination must be a directory if you are
  260.           copying multiple files or copying recursively.
  261.  
  262.  
  263.  
  264.   Return Value:
  265.   -------------
  266.  
  267.   If WinsockRCP successfully copies all specified files, it will return a
  268.   positive value that denotes the total number of files copied.  Note that this
  269.   number includes only individual files copied, not directory names created
  270.   through recursive copies.
  271.  
  272.   However, if you copy files between two remote hosts (you specify a host name
  273.   in the source and destination, resulting in no files copied to or from the
  274.   local PC), a success will return zero, not the number of files copied.
  275.  
  276.   If WinsockRCP is not successful, it will return a negative number indicating
  277.   the last error that occurred.  A list of these error numbers is provided
  278.   later.  Note that if multiple files are to be copied, it will return a
  279.   negative value if an error occurs on any of the transfers.  WinsockRCP may
  280.   have successfully copied files prior to the error and depending on the
  281.   problem, may continue to copy the remaining files.  If you are copying
  282.   multiple files, the RCP protocol does not stop copying files when an error
  283.   occurs unless it is a network error.  
  284.  
  285.   
  286.   Notes:
  287.   ------
  288.  
  289.   A Host: must be specified for either the Source or Dest parameters, or
  290.   both.  You cannot use WinsockRCP to copy files locally; you will receive
  291.   an error if you try.
  292.  
  293.   You should not use the Host: parameter when referencing local files.  If
  294.   you do, you must be running a Remote Shell Daemon (RSHD) that allows RCP
  295.   transfers, such as Denicomp Systems' Winsock RSHD.
  296.   
  297.   If a full directory path is not specified for a remote host, the path
  298.   begins at the user's home directory.  That is, if the file/directory
  299.   name specified after the Host: parameter does not begin with a slash (/),
  300.   it is assumed to reference a file/directory in the user's home directory.
  301.  
  302.   For example, the file "joe@remhost:file.txt" refers to the file "file.txt"
  303.   in the home directory of the user "joe" on the host "remhost".
  304.  
  305.   Filenames may contain either slashes (/) or backslashes (\) as directory
  306.   separators, for either the host file/directory or file/directories on the
  307.   PC.  They will be converted to the appropriate separator.
  308.  
  309.   You can copy multiple files by using wildcard characters, such as * or ?.
  310.  
  311.   The Source and Dest parameters may include only ONE file specification
  312.   each.  That is, you CANNOT specify multiple source files by separating
  313.   them with spaces as you can with the "rcp" command.  To copy multiple
  314.   individual filenames (that cannot be specified using wildcards or using
  315.   a recursive copy), you must call WinsockRCP for each file or use the
  316.   WinsockArrRCP or WinsockArrRCP2 functions.
  317.  
  318.   If you copy multiple source files with wildcard characters, the destination
  319.   the destination must be a directory.
  320.  
  321.   Note that a colon (:) terminates the host name.  This causes a problem
  322.   when filenames on the PC require a drive letter (e.g. A:).  If a file
  323.   name specification begins with one character between A and Z and is
  324.   followed by a colon (:), WinsockRCP will interpret this as a drive letter
  325.   instead of a host name.  This means that WinsockRCP cannot handle one
  326.   character host names.
  327.  
  328.   The destination cannot contain only a drive specification (e.g. A:).  It
  329.   must also include a filename or a directory name.  If the destination is
  330.   the current directory on the drive, use "." (e.g. A:.).
  331.  
  332.   Using the ASCII conversion option to transfer files TO the remote host will
  333.   slow the operation of Winsock RCP32.DLL somewhat because it must read each
  334.   file twice.  It reads the file once to calculate the new translated file
  335.   size, then reads it again to transfer the data.  This is because the RCP
  336.   protocol requires that the exact file size be transmitted before the actual
  337.   data in the file is sent.  Without the conversion option, the file size can
  338.   be found by examining the file's directory entry, but with the conversion
  339.   option, the file's contents must be examined to determine the size after
  340.   CR/NL combinations are replaced with NL.
  341.  
  342.   The ASCII conversion option will also slow Winsock RCP when when
  343.   transferring files FROM the remote host, but only slightly.
  344.  
  345.   If transmission speed is critical, consider using utilties to translate the
  346.   text files after they are transferred.
  347.  
  348.  
  349.   SECURITY 
  350.   --------
  351.   
  352.   User Names
  353.   ----------
  354.  
  355.   The local user name determines the file access privileges WinsockRCP
  356.   uses at the remote host.  This name also determines the ownership and
  357.   access modes of the destination file or files.
  358.  
  359.   The local user name is normally the name you used when logging in to
  360.   Windows NT or Windows 95.  For example, if you logged in to Windows as
  361.   the user "joed", WinsockRCP will use "joed" as the user name at the remote
  362.   host.  WinsockRCP will always convert this name to all lowercase characters.
  363.  
  364.   If you specify a user name in either the source or destination filenames
  365.   using the "user@host:" construct, that name will be used instead of your
  366.   Windows user name.
  367.  
  368.   To maintain some compatibility with the 16-bit version, WinsockRCP will
  369.   also continue to look at the file WIN.INI in the Windows directory
  370.   (e.g. \WINNT35 or \WIN95) for an alternate user name.
  371.   
  372.   If WIN.INI contains a section named "[RCP]" and contains an entry named
  373.   "User" in that section, the name specified there will be used as the local
  374.   user name.  For example, WIN.INI might contain:
  375.  
  376.      [RCP]
  377.      User=joe
  378.  
  379.   If this appeared in WIN.INI, the local user name would be "joe" and
  380.   WinsockRCP would use this name at the remote host.
  381.  
  382.   To support multiple users, WinsockRCP will also look for a section named
  383.   "[RCP-user]" in WIN.INI first for an alternate user name, where the "user"
  384.   in the section name is the name used to log in to Windows NT/95.  WinsockRCP
  385.   will look at this section first; if it does not exist, it will then look
  386.   at the "[RCP]" section.
  387.  
  388.   For example, if "Mary Jones" and "John Smith" are both users on the Windows
  389.   PC, but their user names at the remote host are "mary" and "joe" respectively,
  390.   WIN.INI might look like this:
  391.  
  392.      [RCP-John Smith]
  393.      User=john
  394.  
  395.      [RCP-Mary Jones]
  396.      User=mary
  397.  
  398.   When the Windows user "John Smith" runs a program using WinsockRCP, "john"
  399.   will be used at the remote host.  When the Windows user "Mary Jones" runs
  400.   the program, "mary" will be used instead.
  401.  
  402.   Please note that the use of WIN.INI is supported only to maintain some
  403.   compatibility with the 16-bit version of RCP.DLL.  It is highly recommended
  404.   that you maintain the same user names across your systems.
  405.  
  406.  
  407.   Unix Security
  408.   -------------
  409.  
  410.   If the remote host is running the Unix operating system, it allows
  411.   access if one of the following conditions is satisfied:
  412.   
  413.   * The name of the local host (your PC) is listed in the /etc/hosts file
  414.     on the remote host (Unix) with the proper IP address and as an equivalent
  415.     host in the /etc/hosts.equiv file on the remote host.
  416.  
  417.   * If the name of your PC is not in the /etc/hosts.equiv file, the user's home
  418.     directory on the remote host must contain a .rhosts file that lists the
  419.     name of your PC and your user name.
  420.   
  421.     The .rhosts file in the user's home directory must be owned by either
  422.     the user specified or "root", and only the owner should have read and write
  423.     access.  That is, it must have permissions of 0600.
  424.  
  425.   * The user's login on the remote host does not require a password.
  426.  
  427.  
  428.  
  429.   EXAMPLE
  430.   -------
  431.  
  432.    The CRCP program included with the distribution shows a full working
  433.    example of the WinsockRCP2() function call.  It is similar to the
  434.    WinsockRCP() function call illustrated here:
  435.  
  436.    // This example copies the file "system.doc" in the user tom's home
  437.    // directory on the host "remhost" to the directory "\doc" on the PC
  438.  
  439.        int result;
  440.  
  441.        char *rtitle = "Winsock RCP32.DLL Sample";
  442.        char *src = "tom@remhost:system.doc"
  443.        char *dest = "\\doc"
  444.  
  445.        result = WinsockRCP(NULL,rtitle,src,dest,0,0,1,0,0,0);
  446.  
  447.        if (result < 0)
  448.          MessageBox(NULL,"Remote Copy Was Not Successful",rtitle,MB_OK);
  449.        else
  450.          MessageBox(NULL,"Remote Copy Was Successful",rtitle,MB_OK);
  451.  
  452.  
  453.  
  454.  
  455.   =============================================================================
  456.  
  457.   FUNCTION: WinsockRCP2
  458.   ---------------------
  459.  
  460.   C:
  461.  
  462.   INT WinsockRCP2 (Src, Dest, RecurFlag, AsciiFlag, CaseFlag, HiddenFlag,
  463.                    SpaceChar, ErrMsg, ErrLen)
  464.        char *Src;
  465.        char *Dest;
  466.        int RecurFlag;
  467.        int AsciiFlag;
  468.        int CaseFlag;
  469.        int HiddenFlag;
  470.        int SpaceChar;
  471.        char *ErrMsg;
  472.        int ErrLen;
  473.  
  474.   Visual Basic:
  475.  
  476.   Declare Function WinsockRCP2 Lib "RCP32.DLL"
  477.     (ByVal Src As String,
  478.      ByVal Dest As String,
  479.      ByVal RecurFlag As Integer,
  480.      ByVal AsciiFlag As Integer,
  481.      ByVal CaseFlag As Integer,
  482.      ByVal HiddenFlag As Integer,
  483.      ByVal SpaceChar As Integer,
  484.      ByVal ErrMsg As String,
  485.      ByVal ErrLen As Integer) As Integer
  486.  
  487.  
  488.   PowerBuilder:    (In Global External Functions Window)
  489.  
  490.   Function Int WinsockRCP (Ref String Src, &
  491.                            Ref String Dest, &
  492.                            Int RecurFlag, &
  493.                            Int AsciiFlag, &
  494.                            Int CaseFlag, &
  495.                            Int HiddenFlag, &
  496.                            Int SpaceChar, &
  497.                            Ref String ErrMsg, &
  498.                            Int ErrLen) Library "RCMD32.DLL"
  499.   Usage:
  500.   ------
  501.  
  502.   The WinsockRCP2 function performs the same function as the WinsockRCP
  503.   function, but does not display error messages in Windows message boxes.
  504.   Instead, it returns the error messages in the area you provide.  You can
  505.   then display them, ignore them, or process them as you require.
  506.  
  507.   Parameters:
  508.   -----------
  509.  
  510.    Src:        The file or directory to copy.  See WinsockRCP for details.
  511.  
  512.    Dest:       The destination of the file(s).   See WinsockRCP for details.
  513.  
  514.    RecurFlag:  Specifies how directories should be copied.  See WinsockRCP for
  515.                details.
  516.  
  517.    AsciiFlag:  Specifies whether or not the copy should convert the file to the
  518.                proper text file format.  See WinsockRCP  for details. 
  519.  
  520.    CaseFlag:   Specifies whether or not the case of filenames is preserved
  521.                when performing recursive copies or using wildcards.
  522.  
  523.                This affects recursive and wildcard copies ONLY.  If you
  524.                use a specific, individual filename, the case you use will
  525.                be preserved.
  526.  
  527.                With Windows NT, filenames can be stored using mixed case
  528.                characters, even though the filesystem is NOT case sensitive.
  529.                For example, "ABC" and "abc" represent the same file.  However,
  530.                the directory entry is displayed in the case you used when the
  531.                file was created.
  532.                
  533.                If you specify a value of 0, the case of filenames will NOT
  534.                be preserved.  All filenames will be converted to lower case
  535.                characters as they are received from or sent to the host.
  536.  
  537.                If you specify a value of 1, the case of filenames IS preserved.
  538.                Filenames will be created on the local system in the same case
  539.                as they existed on the remote host. Likewise, filenames on the
  540.                local system will be created in the same case on the remote
  541.                host as they appear in the directory on the local system.
  542.  
  543.    HiddenFlag: Specifies whether or not files with the "hidden" attribute
  544.                are copied when doing recursive copies or using wildcards.
  545.  
  546.                If you specify a value of 0, hidden files will not be
  547.                copied.  If you specify a value of 1, hidden files will
  548.                be copied.
  549.  
  550.    SpaceChar:  Allows you to substitute a character for space characters
  551.                (ASCII 32) in filenames.
  552.  
  553.                If you specify a value of 0, filenames are sent to the remote
  554.                host exactly as they appear on the local system or exactly
  555.                as specified in the Dest parameter.
  556.  
  557.                Some systems cannot easily handle filenames with embedded
  558.                spaces.  If you pass a character in this parameter
  559.                (as an integer value), that character will be substituted
  560.                for each space in the filename created on the remote host.
  561.  
  562.                For example, if you pass an underscore (_) in this parameter,
  563.                the filename:
  564.  
  565.                       "this is a file.txt"
  566.  
  567.                will be created on the remote host as:
  568.  
  569.                       "this_is_a_file.txt"
  570.  
  571.                This affects ONLY directory names and filenames created on the
  572.                remote host.  It has no effect when files are being copied from
  573.                the remote host to the local system.
  574.  
  575.    ErrMsg:     A pointer to an area of memory where any error messages generated
  576.                during the copy can be stored.  It cannot be NULL.  This is
  577.                explained in more detail later.
  578.  
  579.    ErrLen:     The total size in bytes of ErrMsg.  This must be greater than or
  580.                equal to 1.
  581.  
  582.  
  583.    This function operates in the same manner as WinsockRCP, but if any errors
  584.    occur during the transfer, the error messages will be accumulated in ErrMsg.
  585.    Unlike WinsockRCP, they will not be displayed in message boxes.  When the
  586.    function returns, if the return value is negative, the text of any error
  587.    messages will be stored in ErrMsg.
  588.  
  589.    Note that multiple errors can occur, since the RCP protocol does not
  590.    necessarily stop transferring files on certain errors.  If multiple errors do
  591.    occur, each error message will be stored in ErrMsg and they will be separated
  592.    by newline characters (ASCII 10).  Hence, ErrMsg will be suitable for use
  593.    with the Windows MessageBox function if you desire.
  594.  
  595.    ErrMsg should be large enough to hold at least a few error messages. 
  596.    WinsockRCP2 will not exceed the size of ErrMsg as specified by the ErrLen
  597.    parameter.  If the area is not large enough to hold an error message, it will
  598.    not be stored.  It is possible that the text of all error messages will not
  599.    be stored in ErrMsg if a large number of errors occur.
  600.  
  601.    The size of ErrMsg (and the value specified for ErrLen) must be greater than
  602.    zero.  If you specify a very small value for ErrLen, no error text will ever
  603.    be stored in ErrMsg since no message will fit,  but return values will still
  604.    be negative if errors occur.
  605.  
  606.    Return Value:
  607.    -------------
  608.  
  609.    If WinsockRCP2 successfully copies all specified files, it will return a
  610.    positive value that denotes the total number of files copied.  Note that this
  611.    number includes only individual files copied, not directory names created
  612.    through recursive copies.
  613.  
  614.    However, if you copy files between two remote hosts (you specify a host name
  615.    in the source and destination, resulting in no files copied to or from the
  616.    local PC), a success will return zero, not the number of files copied.
  617.  
  618.    If WinsockRCP2 is not successful, it will return a negative number indicating
  619.    the last error that occurred.  A list of these error numbers is provided
  620.    later.  Note that if multiple files are to be copied, it will return a
  621.    negative value if an error occurs on any of the transfers.  WinsockRCP2 may
  622.    have successfully copied files prior to the error and depending on the
  623.    problem, may continue to copy the remaining files.  If you are copying
  624.    multiple files, the RCP protocol does not stop copying files when an error
  625.    occurs unless it is a network error.  
  626.  
  627.  
  628.    Declaring the WinsockRCP2 Function in Other Languages
  629.    -----------------------------------------------------
  630.  
  631.    Declarations are provided for the functions in RCMD32.DLL for C, Visual
  632.    Basic, and Powerbuilder.
  633.  
  634.    If you are using some other language, please keep in mind that the
  635.    ErrMsg parameter in the WinsockRCP2() function call is modified by the DLL.
  636.  
  637.    Be sure when creating declarations in your language for the RCMD32.DLL
  638.    functions you keep this in mind.  Some languages require that you specify
  639.    which parameters passed to DLL's will be modified and should be passed as
  640.    a pointer, not as a copy of the variable value in the program.  You may
  641.    receive errors if you do not do this.
  642.  
  643.  
  644.    Languages using Dynamically Allocated Strings
  645.    ---------------------------------------------
  646.  
  647.    The WinsockRCP2 function requires you to pass a pointer to an area of
  648.    memory to store error messages should errors occur (the ErrMsg parameter).
  649.  
  650.    When using C, you can simply pass a pointer to a char array (for example,
  651.    char errmsg[256]) or a pointer to a dynamically allocated area of memory
  652.    (using malloc() or HeapAlloc()).
  653.  
  654.    When using a language that uses dymamically allocated strings, such as
  655.    Visual Basic or Powerbuilder, you must first "force" memory to be allocated
  656.    to a string before passing it as the ErrMsg parameter in WinsockRCP2().
  657.    If you do not do this, your program will most likely abort with an error.
  658.  
  659.    This can be done in Visual Basic with the String$() function.  For example,
  660.    to allocate 256 bytes in the string EMsg, use the following:
  661.  
  662.             Dim EMsg As String
  663.  
  664.             EMsg = String$(256,Chr$(0))
  665.  
  666.  
  667.   This will allocate 256 bytes in EMsg and fill it with null characters.  If
  668.   you just tried to use EMsg without doing this, your program would abort
  669.   with a memory access error if WinsockRCP2 tried to store an error message
  670.   in EMsg.
  671.  
  672.   Powerbuilder has a similar requirement, but you use the Space() function.
  673.   For example:
  674.  
  675.             String EMsg
  676.  
  677.             EMsg = Space(256)
  678.  
  679.   This will allocate 256 bytes in EMsg and fill it with space characters.
  680.   This is acceptable because WinsockRCP2() will return the error message
  681.   as a null-terminated string.
  682.  
  683.  
  684.   EXAMPLE
  685.   -------
  686.  
  687.    For a full working example of the WinsockRCP2 function in C, see the CRCP
  688.    program included in the distribution.
  689.  
  690.    // This example copies the file "system.doc" in the user tom's home
  691.    // directory on the host "remhost" to the directory "\doc" on the PC
  692.    // If any error occurs, we will display it.
  693.  
  694.        int result;
  695.  
  696.        char *src = "tom@remhost:system.doc"
  697.        char *dest = "\\doc"
  698.        char errmsg[256];
  699.  
  700.        result = WinsockRCP2(rtitle,src,dest,0,0,0,0,0,errmsg,
  701.                             sizeof(errmsg));
  702.  
  703.        if (result < 0)
  704.          MessageBox(NULL,errmsg,"RCP Error!",MB_OK);
  705.  
  706.  
  707.   =============================================================================
  708.  
  709.   FUNCTION: WinsockArrRCP
  710.  
  711.   Syntax:
  712.   -------
  713.  
  714.   C:
  715.   
  716.   INT WinsockArrRCP (hWndParent, Title, ArgArr, ArgCount,
  717.                      RecurFlag, AsciiFlag, ConsoleFlag, CaseFlag, HiddenFlag,
  718.                      SpaceChar)
  719.   
  720.        HWND hWndParent;
  721.        char *Title;
  722.        char **ArgArr;
  723.        int ArgCount;
  724.        int RecurFlag;
  725.        int AsciiFlag;
  726.        int ConsoleFlag;
  727.        int CaseFlag;
  728.        int HiddenFlag;
  729.        int SpaceChar;
  730.   
  731.  
  732.   Usage:
  733.   ------
  734.   
  735.   The WinsockArrRCP function is similar to the WinsockRCP function, but
  736.   accepts an array of strings containing the source and destination filenames.
  737.  
  738.   This allows you to copy multiple source files/directories in a single call
  739.   when the files cannot be named using a single wildcard pattern.
  740.  
  741.   Any errors that occur are displayed in standard Windows message boxes.
  742.   See the WinsockArrRCP2() function if you wish to handle the displaying
  743.   of error messages within your program.
  744.  
  745.  
  746.   Parameters:
  747.   -----------
  748.  
  749.   The parameters to the WinsockArrRCP function are the same as those passed to
  750.   the WinsockRCP function, except for the Src and Dest parameters.
  751.  
  752.   WinsockArrRCP substitutes the following parameters for Src and Dest:
  753.  
  754.   
  755.   ArgArr:      Pointer to an array of strings.  This array must contain two
  756.                or more strings.  The LAST string in the array will be
  757.                considered the destination of the copy.
  758.  
  759.   ArgCount:    The number of strings in the array.
  760.  
  761.  
  762.  
  763.   Notes:
  764.   ------
  765.  
  766.   The same rules for WinsockRCP apply to this function.  Refer to that
  767.   section.  However, here are a few important points:
  768.  
  769.   A Host: must be specified for either the Source files/directories or the
  770.   destination file/directory (or both).  The destination is always the LAST
  771.   string in the array.
  772.  
  773.   If you copy multiple source files, the destination the destination must be
  774.   a directory.
  775.  
  776.  
  777.   IMPORTANT NOTE:
  778.  
  779.   The WinsockArrRCP function MAY MODIFY the values in the array of strings
  780.   passed to it.  To avoid confusion and problems with directory separator
  781.   differences between operating systems, WinsockArrRCP will convert all
  782.   backslashes (\) that appear in the array of strings to slashes (/).  After
  783.   the WinsockArrRCP completes, the array of strings will be changed in your
  784.   program if it contained any backslashes.
  785.  
  786.   If you require that the strings be maintained in their original form,
  787.   make a copy of the array and pass the copy to WinsockArrRCP.
  788.  
  789.  
  790.   EXAMPLE
  791.   -------
  792.  
  793.    // This example copies the files "plan.xls" and "bills.xls" in the
  794.    // current directory to the "/u/hold" directory on the "unix486" system.
  795.  
  796.        int result;
  797.  
  798.        char *rtitle = "Winsock RCP32.DLL Sample";
  799.        char *args[] = { "plan.xls", "bills.xls", "unix486:/u/hold" };
  800.  
  801.        result = WinsockArrRCP(NULL,rtitle,args,3,0,0,1,0,0,0);
  802.  
  803.        if (result < 0)
  804.          MessageBox(NULL,"Remote Copy Was Not Successful",rtitle,MB_OK);
  805.        else
  806.          MessageBox(NULL,"Remote Copy Was Successful",rtitle,MB_OK);
  807.  
  808.  
  809.  
  810.   =============================================================================
  811.  
  812.  
  813.   FUNCTION: WinsockArrRCP2
  814.   ------------------------
  815.  
  816.   C:
  817.  
  818.   INT WinsockArrRCP2 (ArgArr, ArgCount, RecurFlag, AsciiFlag, CaseFlag,
  819.                       HiddenFlag, SpaceChar, ErrMsg, ErrLen)
  820.        char **ArgArr;
  821.        int ArgCount;
  822.        int RecurFlag;
  823.        int AsciiFlag;
  824.        int CaseFlag;
  825.        int HiddenFlag;
  826.        int SpaceChar;
  827.        char *ErrMsg;
  828.        int ErrLen;
  829.  
  830.   Usage:
  831.   ------
  832.   
  833.   The WinsockArrRCP2 function is similar to the WinsockRCP2 function, but
  834.   accepts an array of strings containing the source and destination filenames.
  835.  
  836.   This allows you to copy multiple source files/directories in a single call
  837.   when the files cannot be named using a single wildcard pattern.
  838.  
  839.   This function is similar to the WinsockArrRCP function, but does not
  840.   display error messages in Windows message boxes.  Instead, it returns the
  841.   error messages in the area you provide.  You can then display them, ignore
  842.   them, or process them as you require.
  843.  
  844.  
  845.   Parameters:
  846.   -----------
  847.  
  848.   The parameters to the WinsockArrRCP2 function are the same as those passed to
  849.   the WinsockRCP2 function, except for the Src and Dest parameters.
  850.  
  851.   WinsockArrRCP2 substitutes the following parameters for Src and Dest:
  852.  
  853.   
  854.   ArgArr:      Pointer to an array of strings.  This array must contain two
  855.                or more strings.  The LAST string in the array will be
  856.                considered the destination of the copy.
  857.  
  858.   ArgCount:    The number of strings in the array.
  859.  
  860.  
  861.  
  862.   Notes:
  863.   ------
  864.  
  865.   The same rules for WinsockRCP2 apply to this function.  Refer to that
  866.   section.  However, here are a few important points:
  867.  
  868.   A Host: must be specified for either the Source files/directories or the
  869.   destination file/directory (or both).  The destination is always the LAST
  870.   string in the array.
  871.  
  872.   If you copy multiple source files, the destination the destination must be
  873.   a directory.
  874.  
  875.  
  876.   IMPORTANT NOTE:
  877.  
  878.   The WinsockArrRCP2 function MAY MODIFY the values in the array of strings
  879.   passed to it.  To avoid confusion and problems with directory separator
  880.   differences between operating systems, WinsockArrRCP2 will convert all
  881.   backslashes (\) that appear in the array of strings to slashes (/).  After
  882.   the WinsockArrRCP2 completes, the array of strings will be changed in your
  883.   program if it contained any backslashes.
  884.  
  885.   If you require that the strings be maintained in their original form,
  886.   make a copy of the array and pass the copy to WinsockArrRCP2.
  887.  
  888.  
  889.   EXAMPLE
  890.   -------
  891.  
  892.    // In this example, we will simply use the standard command line arguments
  893.    // (argv[]) and pass them through to the WinsockArrRCP2 function.  If you
  894.    // modify the CRCP example program included with this package to do this
  895.    // you will be able to specify multiple source files on the command line.
  896.    // If any error occurs, we will display it.
  897.  
  898.    main(int argc, char **argv)
  899.    {
  900.        int result;
  901.  
  902.        char errmsg[256];
  903.  
  904.        // Skip argv[0] - that's the program name!
  905.        result = WinsockArrRCP2(&argv[1],argc-1,0,0,0,0,0,errmsg,
  906.                                sizeof(errmsg));
  907.  
  908.        if (result < 0)
  909.          MessageBox(NULL,errmsg,"RCP Error!",MB_OK);
  910.    }
  911.  
  912.   =============================================================================
  913.  
  914.  
  915.   RETURN VALUES FOR ERRORS
  916.   ------------------------
  917.  
  918.   When an error occurs during a file transfer with WinsockRCP, WinsockRCP2, 
  919.   WinsockArrRCP, or WinsockArrRCP2, a negative value is returned indicating
  920.   the last error that occurred.  Constants for these error numbers are defined
  921.   for you in the files RCPERRS.H (for C) and RCPERRS.BAS (for Visual Basic).
  922.   The following are the possible values:
  923.  
  924.  
  925.   Error            Meaning
  926.   Number
  927.  
  928.   -1     No host specified for any filename.
  929.  
  930.   -2     Unacceptable user name before @ sign in filename.
  931.  
  932.   -3     The error message was received from the remote host.
  933.  
  934.   -4     Lost the connection to the host prematurely (network error)
  935.  
  936.   -5     Cannot allocate memory.
  937.  
  938.   -6     Can't get user from Windows or WIN.INI.
  939.  
  940.   -7     Target is ambiguous.
  941.  
  942.   -8     Invalid file type to send (directory was specified without recursion).
  943.  
  944.   -9     No match for wildcard on remote host.
  945.  
  946.   -10    RCP Protocol Error.
  947.  
  948.   -11    Can't get information about a directory on the PC.
  949.  
  950.   -12    Error in the wildcard pattern used.
  951.  
  952.   -13    Can't get information about a file to send. 
  953.  
  954.   -14    Can't open a file to send. 
  955.  
  956.   -15    Error reading a file while sending.
  957.  
  958.   -16    Cannot get the filenames in a directory.
  959.  
  960.   -17    Pathname is too long.
  961.  
  962.   -18    Cannot open a file to be received for writing.
  963.  
  964.   -19    Error adjusting file size after receiving.  Possibly out of disk space.
  965.  
  966.   -20    Error writing file while receiving.  Possibly out of disk space.
  967.  
  968.   -21    Too many simultaneous connections to RCP32.DLL.
  969.  
  970.  
  971.  
  972. SUPPORT
  973. -------
  974.  
  975. Support is available via U.S. Mail and Compuserve/Internet:
  976.  
  977. Denicomp Systems
  978. P.O. Box 731
  979. Exton, PA  19341
  980.  
  981. Compuserve: 71612,2333
  982. Internet:   71612.2333@compuserve.com
  983.  
  984.